datasg segment
tem db 6,7 dup  (0)
i dw 0
sum dw 0
T1 dw 0
T2 dw 0
T3 dw 0
printf_sum10 db 'sum:$'
datasg ends
codesg segment
assume cs:codesg,ds:datasg
start:
MOV AX,datasg
MOV DS,AX
L1: mov AX, 0
mov i, AX
L2: mov AX, 0
mov sum, AX
L3: mov AX, 10
add AX, 1
mov BX ,AX
 mov AX, i
sub AX, BX
L4: jnc TheEnd
L5: mov AX, sum
add AX, i
mov T2, AX
L6: mov AX, T2
mov sum, AX
L7: mov AX, i
add AX, 1
mov T3, AX
L8: mov AX, T3
mov i, AX
L9: jmp L3
TheEnd:nop


;PRINTF
L10:
lea dx,printf_sum10
mov ah,9
int 21h
mov ax,sum
xor cx,cx
mov bx,10
PT010:xor dx,dx
div bx
or dx,0e30h;0e:显示字符
push dx
inc cx
cmp ax,0;ZF=1则AX=0,ZF=0则AX！=0
jnz PT010;相等时跳转
PT110:pop ax
int 10h;显示一个字符
loop PT110
mov ah,0 
;int 16h ;键盘中断
;换行
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h


mov ax,4c00h; int 21h的4ch号中断，安全退出程序！
int 21h;调用系统中断！
codesg ends
end start
